﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListContact.ascx.cs" Inherits="Team4Mock.UserControl.Contact.ListContact" %>
<%@ Register Assembly="Trirand.Web" TagPrefix="trirand" Namespace="Trirand.Web.UI.WebControls" %>
<style type="text/css">
    .style1
    {
        width: 109px;
    }
    .style2
    {
        width: 104px;
    }
    .style3
    {
        width: 246px;
    }
    .button
    {
        background-color: #465c71;
        width: 80px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        -webkit-border-radius: 3px;
        color: White;
    }
    .button:hover
    {
        background-color: #bfcbd6;
        color: #465c71;
    }
    #txtFirstName
    {
        width: 160px;
    }
    .style6
    {
        height: 31px;
    }
    .style7
    {
        height: 34px;
    }
    .style8
    {
        height: 35px;
    }
    .style9
    {
        height: 33px;
    }
    .style10
    {
        width: 104px;
        height: 34px;
    }
</style>
<script type="text/javascript">
    function Return() {
        var Str = document.getElementsByName('select').length;
        for (var i = 0; i < document.getElementsByName('select').length; i++) {
            var a = document.getElementsByName('select').item(i).checked;
            if (a == true) {
                var s=document.getElementsByName('select').item(i).value;
                var kq = s.split("-");
                window.opener.document.getElementById('Name').value = kq[0];
                window.opener.document.getElementById('id').value = kq[1];
                window.close();
            }
        }
    }

    function Close() {
        window.close();
    }
    
</script>

<asp:Panel ID="pnList" runat="server">
<fieldset style="width: 760px;">
    <legend style="height: 25px; background-color: #465c71; -webkit-border-radius: 5px 5px 0px 0px;
        color: #dde4ec;font-size:18px;">Contact Lookup</legend>
    <div style="width: 750px; margin-left: 10px;">
        <h3>
            Search Contact</h3>
        <hr />
        <table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td class="style1">
                    First Name
                </td>
                <td class="style3">
                    <input type="text" id="txtFirstName" />
                </td>
                <td class="style2">
                    Surname
                </td>
                <td>
                    <asp:TextBox ID="txtSurname" runat="server" Width="160px"></asp:TextBox>
                    <input type="hidden" id="txtHidden" name="txtHidden" />
                </td>
            </tr>
        </table>
        <br />
        <asp:Button ID="btnSearch" runat="server" Style="width: 120px;" CssClass="button"
            Text="Search Contact" />
            <asp:Button ID="btnCreate" runat="server" CssClass="button" Text="Create" 
            onclick="btnCreate_Click1" />
                <asp:Button ID="btnClear" runat="server" CssClass="button" Text="Clear" />
                <br />
        <br />
        <asp:CheckBox ID="ckActive" runat="server" Text="Include In-active contact?" /><br />
        <asp:GridView ID="gvContact" AutoGenerateColumns="false" DataKeyNames="ContactID" runat="server"
            Width="709px" Font-Size="15px" BackColor="White" BorderColor="#CCCCCC" AllowSorting="true"
            BorderStyle="None" BorderWidth="1px" CellPadding="3">
            <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <input type="radio" id="select" name="select" value='<%#Eval("Contact Name")+"-"+Eval("ContactID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ID" Visible="false">
                        <ItemTemplate>
                            <%--<asp:Label ID="lbID" runat="server" Text='<%#Eval("ContactID") %>'></asp:Label>--%>
                            <input type="hidden" id="ContactID" value='<%#Eval("ContactID") %>'/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Contact Name">
                        <ItemTemplate>
                            <asp:HyperLink ID="OrgName" runat="server" Text='<%#Eval("Contact Name") %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Mobile Phone">
                        <ItemTemplate>
                            <asp:Label ID="lbHOA" runat="server" Text='<%#Eval("MobilePhone") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Email">
                        <ItemTemplate>
                            <asp:Label ID="lbPostcode" runat="server" Text='<%#Eval("Email") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Contact Type">
                        <ItemTemplate>
                            <asp:Label ID="lbContact" runat="server" Text='<%#Eval("ContactTypeName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Is Active">
                        <ItemTemplate>
                            <asp:Label ID="lbActive" runat="server" Text='<%#Eval("IsActive") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
        <br />
        <asp:Button ID="btnSelect" runat="server" CssClass="button" Text="Select" 
            OnClientClick="Return()" onclick="btnSelect_Click" />
        <asp:Button ID="btnClose" runat="server" CssClass="button" Text="Close" OnClientClick="Close()" />
        <br />
        <asp:Label ID="tb" runat="server"></asp:Label>
    </div>
</fieldset>
</asp:Panel>
<asp:Panel ID="pnAdd" runat="server">
    <fieldset style="width: 760px; margin-left: 10px;">
    <legend style="height: 25px; background-color: #465c71; -webkit-border-radius: 5px 5px 0px 0px;
        color: #dde4ec;">Contact Details</legend>
    <h2>
        Create New Contact</h2>
    <table width="765px" cellpadding="0px" cellspacing="0px" border="0" style="font-size: 15px;">
        <tr>
            <td class="style3">
                First Name <span style="color: Red;">(*)</span>
            </td>
            <td class="style3">
                <asp:TextBox ID="txtPartName" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style3">
                Manager Name
            </td>
            <td class="style3">
            <input type="text" id="txtContactID" readonly="readonly"/>
            <asp:HiddenField ID="txtBusiness" runat="server" />
                &nbsp;&nbsp;<a href="#" onclick="basicPopup();return false;">Lookup</a>
            </td>
        </tr>
        <tr>
            <td class="style6">
                Surname<span style="color: Red;">(*)</span>
            </td>
            <td class="style6">
                <asp:TextBox ID="TextBox1" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style6">
                Contact Type&nbsp; <span style="color: Red;">(*)</span>
            </td>
            <td class="style6">
                <asp:DropDownList ID="dlContactType" runat="server" Width="180px">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style7">
                Knows As
            </td>
            <td class="style7">
                <asp:TextBox ID="txtKnowsAs" Width="186px" runat="server"></asp:TextBox>
            </td>
            <td class="style7">
                Best Contact Method
            </td>
            <td class="style7">
                <asp:DropDownList ID="DropDownList1" runat="server" Width="180px">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style8">
                Office Phone
            </td>
            <td class="style8">
                <asp:TextBox ID="TextBox2" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style8">
                Job Role
            </td>
            <td class="style8">
                <asp:TextBox ID="txtRole" runat="server" Width="186px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style9">
                Mobile Phone
            </td>
            <td class="style9">
                <asp:TextBox ID="TextBox3" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style9">
                Workbase
            </td>
            <td class="style9">
                <asp:TextBox ID="TextBox4" runat="server" Width="186px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                ST Home Phone
            </td>
            <td class="style8">
                <asp:TextBox ID="TextBox5" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style8">
                Job Title
            </td>
            <td class="style8">
                <asp:TextBox ID="TextBox6" runat="server" Width="186px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style7">
                Email Address
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBox7" runat="server" Width="186px"></asp:TextBox>
            </td>
            <td class="style7">
                Is Active
            </td>
            <td class="style7">
                <asp:CheckBox ID="CheckBox1" runat="server" />
            </td>
        </tr>
    </table>
    <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button"/>
    <asp:Button ID="btnBack" runat="server" Text="Back" CssClass="button" 
            onclick="btnBack_Click" />
</fieldset>
</asp:Panel>